package com.example.club.clubmanage.model;


import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.telephony.TelephonyManager;

import com.example.club.clubmanage.Constant;
import com.example.club.clubmanage.MyApplication;
import com.example.club.clubmanage.utils.SharedPreferencesUtil;

import java.io.Serializable;


/**
 * Created by Caolibao on 2015/9/16.
 */
public class BaseVo implements Serializable {
    private String token;
    private int timestamp;
    private String imei;
    private String imsi;
    private String number;     //发起请示的手机号码
    private String phoneType;  //Anroid，IOS
    private String version;
    private int versionCode;
    private String clientId; //推送服务令牌（设备唯一标识），用于标识推送信息接收者身份

    public BaseVo() {
        //读取当前用户的id
        //读取用户对象
        UserDto user = SharedPreferencesUtil.readUserDto();
        if (user != null) {
            this.token = user.getToken();

        }
        this.timestamp = (int) (System.currentTimeMillis() / 1000);
        Context context = MyApplication.application;
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

        this.imei = tm.getDeviceId();
        this.imsi = tm.getSubscriberId();
        this.phoneType = "Android";
        this.version = Build.VERSION.CODENAME;
        this.versionCode = Build.VERSION.SDK_INT;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public int getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(int timestamp) {
        this.timestamp = timestamp;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public String getImsi() {
        return imsi;
    }

    public void setImsi(String imsi) {
        this.imsi = imsi;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public int getVersionCode() {
        return versionCode;
    }

    public void setVersionCode(int versionCode) {
        this.versionCode = versionCode;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getPhoneType() {
        return phoneType;
    }

    public void setPhoneType(String phoneType) {
        this.phoneType = phoneType;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    @Override
    public String toString() {
        return "BaseVo{" +
                "token='" + token + '\'' +
                ", timestamp=" + timestamp +
                ", imei='" + imei + '\'' +
                ", imsi='" + imsi + '\'' +
                ", number='" + number + '\'' +
                ", phoneType='" + phoneType + '\'' +
                ", version='" + version + '\'' +
                ", versionCode=" + versionCode +
                ", clientId='" + clientId + '\'' +
                '}';
    }
}
